<?php
function getAllFileName($dir = null){
    if (empty($dir)){
        $dir = __DIR__;
    }
    $data = [];
    $allFile = scandir($dir);
    foreach ($allFile as &$item){
        if ($item == '.' || $item == '..'){
            continue;
        }
        if (is_dir($dir.'/'.$item)){
            $arr = getAllFileName($dir.'/'.$item);
            if (!empty($arr)){
                $data = array_merge($data, $arr);
            }
        } else {
            if (substr($item, -4, 4) == '.php'){
                $name = str_replace('.php', '', $item);
                if ($name != 'Base'){
                    $data[] = str_replace('.php', '', $item);
                }

            }
        }
    }
    return $data;
}

$arr = [
    'api' => getAllFileName(__DIR__.'/../application/api/controller'),
    'admin' => getAllFileName(__DIR__.'/../application/admin/controller')
];
$model = [
    'api' => "app\\api\\controller\\",
    'admin' => "app\\admin\\controller\\",
];
$data = [
    'title' => "APi接口文档",  //文档title
    'version'=>'1.0.0', //文档版本
    'copyright'=>'报名', //版权信息
    'password' => '', //访问密码，为空不需要密码
    //静态资源路径--默认为云上路径，解决很多人nginx配置问题
    //可将assets目录拷贝到public下面，具体路径课自行配置
    'static_path' => '',
    'controller' => [],
    'filter_method' => [
        //过滤 不解析的方法名称
        '_empty'
    ],
    'return_format' => [
        //数据格式
        'status' => "false/true（false表示失败，true表示成功）",
        'message' => "提示信息",
    ],
    'public_header' => [
        //全局公共头部参数
        //如：['name'=>'version', 'require'=>1, 'default'=>'', 'desc'=>'版本号(全局)']
        
    ],
    'public_param' => [
        //全局公共请求参数，设置了所以的接口会自动增加次参数
        //如：['name'=>'token', 'type'=>'string', 'require'=>1, 'default'=>'', 'other'=>'' ,'desc'=>'验证（全局）')']
    ],
];
foreach ($arr as $key => $item){
    $str = $model[$key];
    foreach ($item as $value){
        $data['controller'][] = $str.$value;
    }
}
return $data;

